package aad.storyboard.model;

import utils.ViewUtils;
import aad.storyboard.controller.GUIComposer;
import aad.storyboard.view.GraphicView;
import android.graphics.Rect;

public class ParticleAnimation extends Animation{

	private ParticleEffect explosion;
	private Rect container;
	
	public ParticleAnimation(int duration, int t, int size, int x, int y, int color) {
		super(duration, t);	
		
		explosion = new ParticleEffect(size, x, y, color);
		container=new Rect();
		container.left=0;
		container.top=0;
		container.bottom=ViewUtils.screenHeight;
		container.right=ViewUtils.screenWidth;	
		
	}

	@Override
	public void animate() {
	 GraphicView g= (GraphicView) GUIComposer.getInstance().getGraphicalView();
	 g.setParticleEffect(explosion);
		if (explosion.isAlive()) {
			explosion.update(container);
		}
		else g.setParticleEffect(null);
	}

	
	public void setContainer(Rect container)
	{
		this.container=container;
	}
	
	@Override
	public void adjustParameters() {
				
	}

}
